import 'package:demo/pages/navpages/message_page.dart';
import 'package:demo/pages/navpages/personal_page.dart';
import 'package:demo/pages/navpages/report_page.dart';
import 'package:demo/pages/navpages/shop_page.dart';
import 'package:flutter/material.dart';

class MainPage extends StatefulWidget {
  const MainPage({Key? key}) : super(key: key);

  @override
  State<MainPage> createState()=> _MainPageState();
}

class _MainPageState extends State<MainPage>{
  List pages = [
    const MessagePage(),
    // const ReportPage(),
    const ShopPage(),
    const PersonalPage()
  ];

  int currentIndex = 0;
  void onTap(int index){
    setState(() {
      currentIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // backgroundColor: Colors.white,
      body: pages[currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        unselectedFontSize: 0,
        selectedFontSize: 0,
        type: BottomNavigationBarType.shifting,
        backgroundColor: Colors.white,
        onTap: onTap,
        currentIndex: currentIndex,
        selectedItemColor: Colors.black54,
        unselectedItemColor: Colors.grey.withOpacity(0.5),
        showUnselectedLabels: false,
        showSelectedLabels: false,
        elevation: 0,
        items: const [
          BottomNavigationBarItem(label: "Message",icon: Icon(Icons.message)),
          // BottomNavigationBarItem(label: "Report",icon: Icon(Icons.report)),
          BottomNavigationBarItem(label: "Shop",icon: Icon(Icons.shop)),
          BottomNavigationBarItem(label: "Person",icon: Icon(Icons.person)),
        ],
      ),
    );
  }

}
